package com.example.shop.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.File;
import java.time.LocalDate;

/**
 * <p>
 * 商家
 * </p>
 *
 * @author 作者
 * @since 2022-05-29
 */
@Data
@Accessors(chain = true)
public class Merchant extends Model<Merchant> {
    @TableField(exist = false)
    public static final String RESOURCE_ROOT_DIR = "D://electricity_shop//resources//merchant//";
    /**
     * 如果直接使用指定目录保存，而不使用拼接id标识目录保存的话，有个坏处，那就是一个目录下最多只能有65535个（文件和目录总和）
     */
    @TableField(exist = false)
    public static final String GOODS_DIR = File.separator+"goods"+File.separator;
    @TableField(exist = false)
    public static final String EVALUATION_DIR = File.separator + "evaluation"+File.separator;
    private static final long serialVersionUID = 1L;

    @TableId(value = "merchant_id", type = IdType.ASSIGN_ID)
    //商家的唯一标识
    private Long merchantId;
    //商家头像的图片位置
    private String merchantAvatar;
    //商家名、店铺名
    private String merchantName;
    //商家的简介
    private String merchantIntroduction;
    //商家所在位置的经度
    private double merchantLongitude;
    //商家所在位置的纬度
    private double merchantLatitude;
    //商家所在的区域，如：广东省肇庆市
    private String merchantArea;
    //商家的详细地址
    private String merchantDetailedAddress;
    //商家的电话号
    private String merchantPhone;
    //商家的产品和服务的综合质量评分
    private Integer merchantQualityGrade;
    //商家号
    private String merchantAccount;
    //密码
    private String merchantPassword;
    //商家的状态：在线、下线
    private byte merchantState;
    //商家的注册时间
    @TableField(fill = FieldFill.INSERT)
    private LocalDate merchantRegisterDate;
    //商家的资源目录
    private String merchantResourceDir;

    @Override
    public String toString() {
        return "Merchant{" +
                "merchantId=" + merchantId +
                ", merchantAvatar='" + merchantAvatar + '\'' +
                ", merchantName='" + merchantName + '\'' +
                ", merchantIntroduction='" + merchantIntroduction + '\'' +
                ", merchantLongitude=" + merchantLongitude +
                ", merchantLatitude=" + merchantLatitude +
                ", merchantArea='" + merchantArea + '\'' +
                ", merchantDetailedAddress='" + merchantDetailedAddress + '\'' +
                ", merchantPhone='" + merchantPhone + '\'' +
                ", merchantQualityGrade=" + merchantQualityGrade +
                ", merchantAccount='" + merchantAccount + '\'' +
                ", merchantPassword='" + merchantPassword + '\'' +
                ", merchantState=" + merchantState +
                ", merchantResourceDir='" + merchantResourceDir + '\'' +
                '}';
    }
}
